.class public Lcom/esfile/screen/recorder/ui/DuSwitchButton;
.super Landroid/widget/FrameLayout;
.source "DuSwitchButton.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;,
        Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;
    }
.end annotation


# instance fields
.field private a:Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;

.field private b:Landroid/view/View;

.field private c:Landroid/view/View;

.field private d:F

.field private e:Landroid/animation/ObjectAnimator;

.field private f:Z

.field private g:Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    const/4 v0, 0x0

    .line 1
    invoke-direct {p0, p1, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1

    const/4 v0, 0x0

    .line 2
    invoke-direct {p0, p1, p2, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0

    .line 3
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 4
    invoke-direct {p0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a()V

    return-void
.end method

.method private a()V
    .locals 3

    .line 2
    invoke-virtual {p0}, Landroid/widget/FrameLayout;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    sget v1, Les/y4;->durec_switch_btn_layout:I

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v0

    .line 3
    sget v1, Les/x4;->durec_switch_track:I

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    iput-object v1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->c:Landroid/view/View;

    .line 4
    sget v1, Les/x4;->durec_switch_thumb:I

    invoke-virtual {v0, v1}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    iput-object v1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    .line 5
    invoke-virtual {v1, p0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 6
    invoke-virtual {p0, p0}, Landroid/widget/FrameLayout;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 7
    invoke-virtual {p0, v0}, Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V

    return-void
.end method

.method static synthetic a(Lcom/esfile/screen/recorder/ui/DuSwitchButton;Z)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->setSwitchResource(Z)V

    return-void
.end method

.method private a(Z)V
    .locals 5

    .line 17
    iget v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->d:F

    const/4 v1, 0x0

    cmpl-float v2, v0, v1

    if-nez v2, :cond_0

    return-void

    :cond_0
    if-eqz p1, :cond_1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    .line 18
    :goto_0
    iget-object v1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    sget-object v2, Landroid/widget/FrameLayout;->TRANSLATION_X:Landroid/util/Property;

    const/4 v3, 0x1

    new-array v3, v3, [F

    const/4 v4, 0x0

    aput v0, v3, v4

    invoke-static {v1, v2, v3}, Landroid/animation/ObjectAnimator;->ofFloat(Ljava/lang/Object;Landroid/util/Property;[F)Landroid/animation/ObjectAnimator;

    move-result-object v0

    iput-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->e:Landroid/animation/ObjectAnimator;

    const-wide/16 v1, 0xfa

    .line 19
    invoke-virtual {v0, v1, v2}, Landroid/animation/ObjectAnimator;->setDuration(J)Landroid/animation/ObjectAnimator;

    .line 20
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->e:Landroid/animation/ObjectAnimator;

    new-instance v1, Lcom/esfile/screen/recorder/ui/DuSwitchButton$a;

    invoke-direct {v1, p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton$a;-><init>(Lcom/esfile/screen/recorder/ui/DuSwitchButton;Z)V

    invoke-virtual {v0, v1}, Landroid/animation/ObjectAnimator;->addListener(Landroid/animation/Animator$AnimatorListener;)V

    .line 21
    iget-object p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->e:Landroid/animation/ObjectAnimator;

    invoke-virtual {p1}, Landroid/animation/ObjectAnimator;->start()V

    return-void
.end method

.method private a(ZZ)V
    .locals 1

    .line 8
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    if-eq v0, p1, :cond_3

    .line 9
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->e:Landroid/animation/ObjectAnimator;

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/animation/ObjectAnimator;->isStarted()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 10
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->e:Landroid/animation/ObjectAnimator;

    invoke-virtual {v0}, Landroid/animation/ObjectAnimator;->cancel()V

    :cond_0
    if-eqz p2, :cond_1

    .line 11
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a(Z)V

    .line 12
    iget-object p2, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a:Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;

    if-eqz p2, :cond_2

    .line 13
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    xor-int/lit8 v0, v0, 0x1

    invoke-interface {p2, p0, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;->a(Lcom/esfile/screen/recorder/ui/DuSwitchButton;Z)V

    goto :goto_0

    .line 14
    :cond_1
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->setThumbToCheckedState(Z)V

    .line 15
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->setSwitchResource(Z)V

    .line 16
    :cond_2
    :goto_0
    iput-boolean p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    :cond_3
    return-void
.end method

.method private setSwitchResource(Z)V
    .locals 2

    .line 1
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->c:Landroid/view/View;

    if-eqz p1, :cond_0

    sget v1, Les/w4;->durec_switch_btn_track_checked:I

    goto :goto_0

    :cond_0
    sget v1, Les/w4;->durec_switch_btn_track_normal:I

    :goto_0
    invoke-virtual {v0, v1}, Landroid/view/View;->setBackgroundResource(I)V

    .line 2
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    if-eqz p1, :cond_1

    sget p1, Les/w4;->durec_switch_btn_thumb_checked:I

    goto :goto_1

    :cond_1
    sget p1, Les/w4;->durec_switch_btn_thumb_normal:I

    :goto_1
    invoke-virtual {v0, p1}, Landroid/view/View;->setBackgroundResource(I)V

    return-void
.end method

.method private setThumbToCheckedState(Z)V
    .locals 3

    .line 1
    iget v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->d:F

    const/4 v1, 0x0

    cmpl-float v2, v0, v1

    if-nez v2, :cond_0

    return-void

    :cond_0
    if-eqz p1, :cond_1

    goto :goto_0

    :cond_1
    const/4 v0, 0x0

    .line 2
    :goto_0
    iget-object p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    invoke-virtual {p1, v0}, Landroid/view/View;->setTranslationX(F)V

    return-void
.end method


# virtual methods
.method public getCheckStatus()Z
    .locals 1

    .line 1
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    return v0
.end method

.method public onClick(Landroid/view/View;)V
    .locals 1

    .line 1
    iget-object p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->g:Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;

    if-eqz p1, :cond_0

    iget-boolean v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    invoke-interface {p1, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;->a(Z)Z

    move-result p1

    if-eqz p1, :cond_0

    return-void

    .line 2
    :cond_0
    invoke-virtual {p0}, Landroid/widget/FrameLayout;->isEnabled()Z

    move-result p1

    if-eqz p1, :cond_1

    .line 3
    iget-boolean p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    const/4 v0, 0x1

    xor-int/2addr p1, v0

    invoke-direct {p0, p1, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a(ZZ)V

    :cond_1
    return-void
.end method

.method protected onLayout(ZIIII)V
    .locals 0

    .line 1
    invoke-super/range {p0 .. p5}, Landroid/widget/FrameLayout;->onLayout(ZIIII)V

    .line 2
    invoke-virtual {p0}, Landroid/widget/FrameLayout;->getWidth()I

    move-result p1

    iget-object p2, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    invoke-virtual {p2}, Landroid/view/View;->getWidth()I

    move-result p2

    sub-int/2addr p1, p2

    int-to-float p1, p1

    iput p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->d:F

    const/4 p2, 0x0

    cmpl-float p2, p1, p2

    if-eqz p2, :cond_0

    .line 3
    iget-boolean p2, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    if-eqz p2, :cond_0

    .line 4
    iget-object p2, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    invoke-virtual {p2, p1}, Landroid/view/View;->setTranslationX(F)V

    .line 5
    iget-boolean p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->f:Z

    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->setSwitchResource(Z)V

    :cond_0
    return-void
.end method

.method public setChecked(Z)V
    .locals 1

    const/4 v0, 0x0

    .line 1
    invoke-direct {p0, p1, v0}, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a(ZZ)V

    return-void
.end method

.method public setClickInterceptor(Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;)V
    .locals 0

    .line 1
    iput-object p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->g:Lcom/esfile/screen/recorder/ui/DuSwitchButton$b;

    return-void
.end method

.method public setClickable(Z)V
    .locals 1

    .line 1
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->setClickable(Z)V

    .line 2
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    invoke-virtual {v0, p1}, Landroid/view/View;->setClickable(Z)V

    return-void
.end method

.method public setEnabled(Z)V
    .locals 1

    .line 1
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->setEnabled(Z)V

    .line 2
    iget-object v0, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->b:Landroid/view/View;

    invoke-virtual {v0, p1}, Landroid/view/View;->setEnabled(Z)V

    return-void
.end method

.method public setOnCheckedChangeListener(Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;)V
    .locals 0

    .line 1
    iput-object p1, p0, Lcom/esfile/screen/recorder/ui/DuSwitchButton;->a:Lcom/esfile/screen/recorder/ui/DuSwitchButton$c;

    return-void
.end method
